from google.appengine.ext import db

workitems = []

def addWorkitem(new_workitem):
    if exist(new_workitem.itemname):
        return False
    workitems.append(new_workitem)  
    return True
    pass
def exist(workitem_id):

    for x in workitems: 
      if workitem_id == x.itemname:
        return True
      else:
          continue
    return False
    pass
def removeWorkitem(new_workitem):
    if exist(new_workitem.itemname):
        workitems.remove(new_workitem)
        return True
    else:
        return False


class workitem(db.Model):
    duedate     = ''
    itemname    = ''
    status      = ''
    priority    = ''
    worklistName  = ''
    comments    = ''
    checkedOutBy = 'youn'

    datafield = ['age','major'] #http://xxx.com/module?age=xx&major=cs
    data = {datafield[0]:'data1'}

    replyback_messageType = ['approved']
    
    
    '''def __init__(self,duedate,itemname,status,priority,workflowId):

        self.due = duedate
        self.itemname = itemname
        self.status = status
        self.priority = priority
        self.workflowId = workflowId'''
        
    def isCheckedOut(self, user_name):
        return self.checkedOutBy==user_name
        
